Start Here - Visual Music

Start Here

If you are new to Babya Visual Music or music itself, this sections will give you few very quick lessons to quickly out your journey! Once you refer to pages in this section you can move to more advanced reference sections where you can get more minor details and more information as and when required.


What's Visual Music all about? - Visual Music

What's Babya Visual Music all about?

Babya Visual Music lets you play 128 instruments on your PC including Flute, Bagpiper and even whistle! You can even record what you are playing, edit it and save it in a file. If you not expert at playing synthesiser keyboard, it provides you a easy to use scripting language to create music just by telling what key in which instrument you want to play for how much time!


What is Note, Octave and bla bla bla? - Visual Music

What is Note, Octave and bla bla bla?

Note

If you have looked at piano's keyboard, you would have noticed the strange pattern of black and white keys that repeats itself. More closely, well, you would have seen that there is total 12 black and white keys in each pattern. Each of this 12 key produces it's own sound called a musical Note.

Octave

This 12 notes are named as a,a#,b,c,c#,d,d#,e,e#,f,g,g#. The note with "#" is called minor note while one without "#" is called major note. And each set of these 12 keys that makes a pattern is called Octave. So if a piano has 84 keys it would have 84/12=7 octaves (because each octave has 12 notes). The first octave will start as left side of piano and last one will end at right side of piano. Lower octave gives notes of low frequency while higher octave gives notes of higher frequency. But each octave has exactly same pattern of notes.

So, when you want to make some musical sound, you should... 1. Tell which note you want to play. 2. Tell in which octave the note is. Thus a note and a octave will uniquely identifies the key you should press in the piano.

Pan

There is also something called Pan. The Pan is nothing but a value that determines whether every key in the piano has equal volume or whether left side key has higher volume. < /P> < /P>


Learn to use Visual Music in 5 min! - Visual Music

Learn to use Babya Visual Music in 5 min!

This is the extra fast tour of Babya Visual Music to quickly let you know most of the features!!

Doing Basics:

  1. Click on any key in the piano and see what's happens.
  2. Press these keys in sequence: Q W E R T Y. Do you hear anything?
  3. Click on any instrument you like and repeat step 1 & 2.
  4. Press the Octave button "2" and press piano keys again. Hear any difference?

How To Do Recording?

  1. At the lower right side there's a button with the symbol of colourful CD. It's button to start recording. And just above that there's button to stop recording.
  2. Press the Record button and then click on the piano keys. You will see something getting written each time when you press the piano keys. You can edit it if you like. To stop recording press that Stop button(or click on Tune > Stop Play/Record menu).
  3. Now to replay what you have recorded, press the Play button (just above the Stop button) or click the menu Tune > Play Selected Tune.
  4. To save your recording Press on the Save button on top toolbar or click File > Save menu.

How to write script?

See the next section MScript Programming Super Quick Guide


- Visual Music

MScript Programming Super Quick Guide

If you know slightest programming, this few steps will teach you MScript by examples in minutes.
Try out each of the following scripts and see what you hear and then read the explanation here!

  1. Write the following script and run it.

    a b c

    Explanation:     Each musical note is a command. Thus this script plays 3 musical notes a, b and c. Musical notes available are a, a#, b, c, c#, d, d#, e,e#, f, g, g#. To know what is a musical note see the topic What is Note, Octave and bla, bla bla
  2. Write the following script and run it.

    INSTRUMENT:Sitar
    a b c

    Explanation: The keyword INSTRUMENT sets the instrument you want to play. Note that instrument could be specified by number or name and there is no space around ":".
  3. Write the following script and run it.

    LABEL:Top
       a b c
    JUMP:Top
    Explanation:     The LABEL command marks a position in the script where you jump later. The JUMP command tells where to jump in the script. So the notes a b c will be played again and again. To stop it press Stop button or click Tune > Stop Play/Recording menu.
  4. Write the following script and run it.

    LABEL:Top
       a b c:7,5
    JUMP:Top

    Explanation:     This one is similar to above except that the Note c has additional parameters. The first parameter specifies for how long Note c should be played. The second parameter specifies for how long to pause before going to next command, i.e., after playing a note how much time to keep silence. You can also use SILENCE command for this. For example above is same as this one:

    LABEL:Top
      a b c:7 SILENCE:5
    JUMP:Top

    See Timing in MScript for more info.
  5. Write the following script and run it.

     SET:Count,3

     LABEL:TOP

       a b c

       MATH:Count,--

    IF:Count,>,0,TOP,BELOW

    LABEL:BELOW

       d e f

    JUMP:TOP

    Explanation:     The SET command sets the value in the variable. MATH command
    does some mathematical operation on the variable (here "--" means decrement
    by 1). Lastly the IF command checks if variable is set to particular value
    and jumps to specified location accordingly.
  6. Write the following script in Tune1.

    I:Bright_Acoustic_Piano
    SET:Count,3
    LABEL:TOP
      a b c
      MATH:Count,--
      IF:Count,>,0,TOP,BELOW
           LABEL:BELOW
              d e f
      JUMP:TOP

    Write the following script in Tune2.

    INSTRUMENT:Timpani
    SET:Count,3
    LABEL:TOP
      a b c
      MATH:Count,--
      IF:Count,>,0,TOP,BELOW
           LABEL:BELOW
              d e f
      JUMP:TOP

    Press Play All Tunes button. You will hear multiple instruments being played simultaneously. You can also play tunes individually.
  7. Managing tunes. You can rename the existing tune, add new tune or delete the one. SeeUsing MScript Editor for more information


FAQ - Visual Music

Frequently Asked Questions

  1. Is this program freeware?
    This program is freeware for personal use. You can make music using this program and sell it. But you must not sell this program, or part of it, or any exclusive idea used in it for money. You must always distribute this program FREE!
  2. In which language it was written?
    This program is entirely written in Microsoft Visual Basic 6.0. Because this program do uses few exclusive features of VB6, you may not able to compile it without few changes in VB5 or earlier versions.
  3. Can I have source code please?
    I do wish to provide the source code of this program free. But such source code distribution usually gets it's ways in to commercial products without knowledge of original authors. So if you want to get source code, write to me at shital_s@usa.net. It's FREE as usual.
  4. To whom do I contact if I get error or doesn't know how to use it? You can contact me at shital_s@usa.net . But there's no guarantee for support. However if things are interesting, I may take up the task!
  5. Who wrote this program?
    It's me, Shital! Visit my home page at http://i.am/shital.
  6. How much hours have been spent in writing this program?
    I first started working on it somewhere in mid/end May, 1999. It's since 2 months today (25th July, 1999) and yes, I've really spend lots of time on it! Calculating atleast 2hr/day and 10hr in weekends, it comes to around 80 man hours of continuous programming!!
  7. Why you are spending so much time in writing such programs (and that too freeware!)?
    Well, Programming is an addiction™. It's bit like pain killer which allows you to forget your sorrows and few problems. And that's necessary to continue to breath. Above all it's just confirmation for your ability to do something challenging and creative in such a non-innovative mechanical software jobs. Please don't ask anything more on this!
  8. Can I take part in development?
    I've always visualised this program as an open source development. Though I would be giving out source code away free some time later, you are welcome to join me and roll out some cool stuff together!! Write to me at shital_s@usa.net and have yourself confirmed!
  9. Why a new language MScript is invented?
    Read the article What Is MScript and you would know (;-).
  10. Where are the automation objects for Babya Visual Music?
    It's all compiled in to same EXE for the time being. Visual Basic cries a lot when you recompile your ActiveX servers with changes in interfaces and makes lots of junk in registry. And as this changes will be going to be there in final version, I haven't compiled this objects and ActiveX controls in separate DLLs and OCX but it's there in same project. However, of course, the code is written in a way that you can detach classes any time in to separate DLL and go away with it.
  11. When the new version is expected?
    Not very soon. After remaining busy for so many days, I've got enormous amount of pending tasks and my home currently looks big garbage box with lots of plastic bags around, dirty floor without 2 weeks of vacuum cleaning, dirty kitchen with real mess of all kind of stuff. I need to go in real world for some time and make these things proper!! So not before atleast a month or two month or 3 months. So if you really want to see some advance join in the development and do-it-yourself!


Features And Functionality - Visual Music

Features And Functionality

Behind the tiny looking screens of Babya Visual Music there are tons of code and
features. Here's the picks!

  1. Babya Visual Music implements full transparent MIDI channel pooling. The sound card can allow only 16 channels simultaneously. However by smart suffeling, Babya Visual Music allows you to create much more tunes and play them simultaneously.
  2. Complete COM based object oriented architecture. Babya Visual Music is just the front end to the ActiveX server objects that actually does the work. You too can build your own front-end using these ActiveX objects with very little code or control the Babya Visual Music from VBScript or VBA.
  3. DDE support: Babya Visual Music also supports many basic commands through DDE. You can control existing Babya Visual Music front-end by writing your own DDE client.
  4. Drag-n-drop of instruments in to the script.
  5. MIDI device crash recovery. If by chance Babya Visual Music crahses, it still will recover and unlock MIDI device when it runs next time.
  6. You can load .MSC file in to Babya Visual Music by clicking it in the explorer.
  7. Babya Visual Music contains buil in compiler and virtual machine for MScript.
  8. You can run lots of MScripts (tunes) simultaneouly. Currently it's done by virtual multithreading.
  9. It supports on-the-fly compilation.
  10. Versatile MIDI Engine. MIDI engine is the heart of the Babya Visual Music which actually supports aliased handles, on-fly-channel allocation, channel pooling and more!
  11. Supports icon/file extension from command line switch.
  12. Visual feedback while playing recorded tune.
  13. Smart versionig, embedded timer information and signature protected MScript file format.
  14. Active flat-look buttons. 3D icons.
  15. Copy/Past of entire MScripts.
  16. Additional info on instruments.
  17. Advanced search on instruments.
  18. Favorite support for instruments.
  19. Sample playing while selecting instruments.
  20. MScript instructions to control MIDI device.
  21. Future support for add-ins and extendibility.
  22. Much of the features of backend ActiveX servers is not yet implemented in fronend.


Using Keyboard - Visual Music

Using Keyboard

Babya Visual Music gives you piano like keyboard which you can click on and play specified note. You can also press Q,W,E,... etc key which are in one row to play the keyboard.


Using InstrumentSelector - Visual Music

Using InstrumentSelector

To Select instrument

Click on the instrument or press arrow keys.

To stop sample sound when selecting the instrument

Press on the % sign to turn on/off this feature.

To see favourite instruments

Press on the 4 to see favourite or all instruments.

To add instrument to favourite

Press on the ü to see favourite or all instruments.

To search for the instrument

Press on the y and type the letters that should be present in any of the word of instrument name


Using MScript Editor - Visual Music

Using MScript Editor

Using MScript editor is easy. You always write a script for a tune. Each tune has some name. A tune is like a function or procedure in normal programming terminology. MScript editor allows you to choose the tune for which you want to write the script. Once you write the script you can press Play button to play it. To know which button is for what, put the mouse over that button for a while.

You can add more tunes by pressing on the "+" sign at the bottom of the list of tunes. To delete the tune press "X" sign. To rename the tune press "~" sign.

To clear the script box, press "X" sign on the right lower corner of it.


Using other controls - Visual Music

Using other controls

Other controls allows you to change Octave, Volume and Pan.

Octave:To change octave, press the button marked with desired octave. Buttons marked with A,B and C are actually hex number for 10, 11 and 12. You can also press Alt + button's number to change octave.

Volume:Simply slide the slider.

Pan:Simply slide the slider.


File Operations - Visual Music

File Operations

You can use File menu to open or Save .MSC file just like any standard Windows application.


Tips - Visual Music

Tips

It's easy to use! No tips as such (;-).


Future Enhancements - Visual Music

Future Enhancements

  1. Very oddly, Babya Visual Music will not fit in to 640 X 480. You will need 800X 600 atleast.
  2. No objects currently exposed outside of EXE to prevent versioning problems for the time being.
  3. Wave file mixing.
  4. Save to MIDI/Wav.
  5. Muli key press in recording support.
  6. Full DDE server and addition command GET_MIDI_HANDLE.
  7. Tune Sequence Editor.
  8. Full drag and drop support.
  9. Play from browser support. Browser plug-in for <MSCRIPT> tag.
  10. True multi threading for instruction processor.
  11. Script debugging, immediate & watch window, break point instructions.
  12. User Interface MSCript Commands - MsgBox, InputBox, PRINT, WaitForKey, OnKeyGo.
  13. Low level commands to directly control MIDIEng.
  14. MIDI input device support.


Keyboard Shortcuts - Visual Music

Keyboard Shortcuts

    1. Play notes: All keys in the row from "Q" to "]"

    2. Play tune: F5

    3. Compile the tune: Ctrl + F5

    4. Go to Instrument Selector: Alt + I

    5. Go to Tune List: Alt + T

    6. Go to Tune Editor: Alt + S

    7. Switch Octave: Alt + (1,2,...,9,A,B,C)

    8. Switch to volume change: Alt + V

    9. Switch to pan change: Alt + P

    10. Stop Play/recording: Ctrl + T

    11. Add new Tune Alt + '+'

    12. Rename Tune Alt + '~'

    13. Delete the Tune Alt + 'X'


Required Files - Visual Music

Required Files

Following should be already installed on your machine before you can run Babya Visual Music.

  1. Visual Basic 6.0 run time libraries.
  2. Windows common controls supplied with Microsoft Internet Explorer 5.0 or later.
  3. The hhctrl.ocx file to view compiled HTML help (.chm files) but this is not necessary.
Babya Visual Music itself consist of following files:
  1. Babya Visual Music.exe
  2. Instruments.ini
  3. VisualMusic.ico (not necessary)
  4. Babya Visual Music.chm (not necessary)
  5. samples folder with several MSC sample files (non nessasary)


System Requirements - Visual Music

System Requirements

Babya Visual Music runs better on faster machines because of real time instruction processing requirements. Infect all non - musical instructions in Babya Visual Music 1.0 between two music instructions should be ideally executed within 60ms. As there could be number of such instructions in big scripts, faster machine will give better results!

I've tested Babya Visual Music 1.0 with fairly acceptable performance on Pentium 200MHz machine with 64MB RAM running Windows98 with no other applications (including Active Desktop) active. However you may run it on slower machines also with possibly some randomness in time intervals. And ofcourse 16-bit or better sound card with MIDI capability is necessary.


MScript Reference - Visual Music

MScript Reference

This section provides detailed discussion on MScript as a language and also it contains complete list of each MScript command and details.


What Is MScript - Visual Music

What Is MScript

MScript is the specially created language just to create music!

You might ask that already so many languages exist so why a new one. Well, I too tried to implement music scripting with existing language but soon realised that I want more. By making this decision I was at disadvantage, however, because I would not only have to create compiler and virtual machines but also debugging environment and detailed documentation. But I thought there wasn't a easy way out once I imagined how a language should look like.

Rest of the things I made easy by making language extremely simple to parse and implement (almost no lex analysis needed). But that's also makes non-programmers to learn this language very easy because there isn't much syntax rules, variables, types, etc. But it still allows you to create good music! One of the most important reason I choose upon new language was that Babya Visual Music required to run many scripts simultaneously. Even it should be easy to run/stop script from another script. Almost all traditional languages supports functions that runs sequentially, i.e. you can't run many different functions simultaneously, share variables and also allow to control each other unless you do some complex multithreading. Unfortunately this isn't a easy task even for experienced programmers, not to talk of musicians. And hence MScript comes in to picture!!


MScript Features - Visual Music

MScript Features

  1. Very simple structure with least numbers of syntax rules.
  2. Anybody can write or extend compiler in almost no time!
  3. Every MScript command is extensible by adding more optional parameters.
  4. Supports 3 styles of comments.
  5. Supports short version for most of the command to quickly do trial and
    error.
  6. Gives you all elementary commands which are easy to grasp and still enough for full control!
  7. It's interpreted.
  8. Simultaneous run/control other scripts and share variables.
  9. Free flaw - delimit by space, tab or new line.
  10. On-fly-compilation - no binaries are produced at all! This is possible due to very easy structure and there's almost no time required in parsing.


MScript syntax overview - Visual Music

MScript Syntax Overview

Every MScript command has this format:

CommandName:Param1,Param2,...

|<----one word without space---->|

Note that

  1. MScript command do not have space anywhere in the entire command, not even in a parameter.
  2. MScript is not case sensitive.
  3. MScript commands could be separated by space, tab or new line. For example,

    LABEL:Top
    a b c
    JUMP:Top

    is equivalent to,

    LABEL:Top a b c JUMP:Top
  4. There could be variable numbers of parameters for a command.
  5. If there is no parameters for the command you can just write CommandName.
  6. You can write variable name also instead of command name. for example,

     SET:InstruNum,39 'Set variable

     'Play instrument according to the value in variable.
      INSTRUMENT:InstruNum
      a b c

    Example2:

     'This script plays same notes for different instruments

     SET:InstruNum,127                   'Initialise variable

     LABEL:PlayNote                      'This is the start of the loop

     INSTRUMENT:InstruNum       'Set instrument and play notes
     c d e f

     MATH:InstruNum,--                 'Next instrument to play and back to the loop
     IF:InstruNum,>=,0,PlayNote

  7. Many MScript commands supports enhanced syntex. For example to set Octave you can do,

    O:3

    But say you want to increment octave value from whatever it's current value,

    you can do,

    O:++

    To decrement current octave value,

    O:--

    However say you want to increase octave temporarily only for playing note.

    The conventional way for this is,

    O:++ 'Increment octave a 'Play the Note a O:-- 'Decrement octave

    But you can do this in one line using extended syntax,

    a:,,++

    Here's the explanation of the above line:

    Every Note command (i.e. a,a#,b,c,c#... etc) has many optional parameters. The 1st parameters tells for how long to play the note. Second parameter says for how long to keep silence after playing note, 3rd parameter says in which octave the note should be played. There are many other parameters too. Refer <>

  8. The most major feature of the MScript is that you can run many scripts simultaneously. Each MScript is referred to as Tune also. You can start/stop another MScript from current one or run all of them simultaneously. Typically each MScript will play one different instrument. There is no limits of how many MScript tunes you could write but at any point of time only 16 MScripts could be active (a MScript is said to be active when it's running and is not playing long silence). Thus you can always have 16 tunes running simultaneously. By clever use of start/stop and RELEASE command you can play upto 64 instruments at once!


Simple MScript Commands - Visual Music

Simple MScript Commands

  1. How to play notes
    See play note by name command.
  2. How to specified Note interval
    See NOTE_INTERVAL command.
  3. How to repeat commands (looping)
    See LABEL and JUMP commands.
  4. How to set variables
    See SET command.
  5. How to check variable values
    See IF command.
  6. How to set instrument, volume, octave
    See INSTRUMENT, VOLUME and OCTAVE commands.
  7. How to start/stop other tune
    See PLAY and STOP commands.


MScript Coding Standard - Visual Music

MScript Coding Standard

  1. Each MScript command except names of the note should be in capital.
  2. MScript variables should be in mixed case and should start with a capital letter.
  3. Labels should also be in mixed case and should start with a capital letter.
  4. Try to avoid writing instrument number instead of instrument name. For example,

    INSTRUMENT:Sitar

    is more preferable then.

    INSTRUMENT:104.

  5. MScript supports 3 styles of comments:

    'VB style comment supported
    --SQL Server style comment supported
    //C++ style comment supported.

    Try to use VB style comments as standard.
  6. MScript supports short names for almost all the commands. For example instead of writing,

    INSTRUMENT:Sitar

    you can write,

    I:Sitar

    This short names are supported to do trial and error quickly and should not be used in released version of your script.


Exit Statement

Stops the execution of the current script.

Syntax

EXIT

The EXIT statement syntax has no arguments

Short Form

None

Remarks

This instruction is same as STOP without any parameters.

Examples

1.

a b c
a# b c#
EXIT
'This won't get played
e f e#

See Also

STOP, PAUSE, RELEASE, PLAY


IF Statement

Compares the value of the variable with the specified value and jumps accordingly to the specified label

Syntax

IF:<Variable Name>,<Comparison Condition>,<Value to compare with>,<Label to jump on if condition is true>, [Label to jump on if condition is false]

The MATH statement syntax has these arguments

Part | Description
Variable Name | Name of the variable whose value is to be compared
Operation | Any of the comparison operation >, <, >=, <=, ==, <>
Value to compare with | A literal value which is to be compared with variable's value
Label to jump on if condition is true | If condition evaluates to true the jump is made to this label
Label to jump on if condition is false | If condition evaluates to false the jump is made to this label. Note that this is optional argument.

Short Form

None

Remarks

This is the basic IF structure that you can use to make decision of where to divert the program flow.

Examples

1.

'Play the notes c# 5 times

SET:Count,5
LABEL:TheLoop
c#
MATH:Count,--
IF:Count,>,0,TheLoop

See Also

LABEL, SET, JUMP


INSTRUMENT Statement

What it does: Sets the amount of loudness with which next notes would be played

Syntax

INSTRUMENT:<Instrument name or number>

The INSTRUMENT statement syntax has these arguments

Part | Description
Instrument name or number | Name or number of the instrument.

Short Form

I

Remarks

Prefer to specify the instrument to play by it's name. You can drag and drop instrument from Instrument Selector in the Babya Visual Music.

Examples

1. Set Music Box instrument

INSTRUMENT:Music_Box
a b c

2. Set instrument by number

INSTRUMENT:118
a b c

3. Set instrument from variable

SET:Count,28
LABEL:TheLoop
INSTRUMENT:Count
c# a a b a#
MATH:Count,++
IF:Count,<,128,TheLoop

See Also

OCTAVE, VOLUME, SET, a, a#, b, c, c#,...


JUMP - MScript Commands - Visual Music

JUMP

Command Format:

JUMP:<Label name>

What it does:

Jumps to the immediate next location where the specified label is there.

Short Form:

J

Parameters:

Label name: Name of label where you want to jump

Value constraints:

Label name: Can not contain space. Label must exist or you will get run time error.

Remarks:

Use JUMP instruction to repeat particular commands again and again.

Examples:

Examples: 1. Play the note c# again and again

LABEL:DoItAgain
c#
JUMP:DoItAgain

See Also:

LABEL, IF


LABEL - MScript Commands - Visual Music

LABEL

Command Format:

LABEL:<Label name>

What it does:

Labels the location in code where you can jump later.

Short Form:

L

Parameters:

Label name: Name of label you want to give

Value constraints:

Label name: Can not contain space. You can't have two labels with same name.

Remarks:

This instruction use used to give a name to the location where you can jump later using JUMP instruction or IF instruction.

Examples:

1. Play the note c# again and again

LABEL:DoItAgain
c#
JUMP:DoItAgain

2. Play the notes c# 5 times

SET:Count,5
LABEL:TheLoop
c#
MATH:Count,--
IF:Count,>,0,TheLoop

See Also:

NOTE, NOFF, a, a#, b, c, c#,...


MATH Statement

Does the mathematical operation on the variable value

Syntax

MATH:<Variable Name>,<Operation>,[Parameters for operation]

The MATH statement syntax has these arguments

Part | Description
Variable Name | Name of the variable to which value will be used in operation
Operation | Mathematical operation ++: Increment variable's value --: Decrement variable's value +=: Add the value specified in 3rd parameter to the variable -=: Subtract the value specified in 3rd parameter to the variable *=: Multiply the value specified in 3rd parameter to the variable /=: Divide the variable's value by the value specified in 3rd parameter ^=: Raise the variable's value by the value specified in 3rd parameter
Parameters for operation | Additional parameter that is required for some of the above operations

Short Form

M

Remarks

This instruction is very basic one which allows you to some arithmetic with variables value. It doesn't support expressions like (2*3/4) etc.

Examples

1.

SET:Count,28
LABEL:TheLoop
INSTRUMENT:Count
c# a a b a#
MATH:Count,++
IF:Count,<,128,TheLoop

See Also

SET, IF, JUMP


NOP Statement

No-OPeration. Does nothing!

Syntax

NOP

The NOP statement syntax has no arguments

Short Form

None

Remarks

This instruction odes not do anything. InstructionProcessor simply ignores this instruction (i.e. does nothing) and executes next one. This instruction can be used as place holder.

Examples

1.

a b c
a# b c#
NOP 'Juts pace filler. In future you can
replace NOP with something else.
e f e#

See Also

STOP, PAUSE, RELEASE, PLAY


Note By Name - MScript Commands - Visual Music

Note

Command Name: Note:<Note Number>,[Note Interval],[Silence interval],[octave],[volume]

What it does: Plays the note specified by the given number. This basically corresponds to the key number of the piano. A full piano could have 88 keys (0 at the left and 87 at right). You can specify which key you want to press.

Short Form: N

Parameters:
Note Number: Direct number of note you want to play. If note specified last note will be played.
Note Interval: How long the note should be played. If note specified standard note interval is used (default is 4).
Silence Interval: How long to keep silence after playing the note. If note specified standard silence interval is used (default is 4).
Octave: In which octave to play the note. Also supports ++ etc operators. If note specified currently set octave is used.
Volume: Volume with which the note should be played. Also supports ++ etc operators. If note specified currently set volume is used.

Value constraints:
Note Number: 0-87, no error for the invalid value.
Note Interval: If 0, Note is played for shortest interval limited only by CPU speed
Silence Interval: If 0, no silence is inserted, i.e., if second note is there it will be played immediately.
Octave: 0 - 7.
Volume: 0-100.

Remarks:
This command is equivalent to commands like a, a#, b. c# etc which plays the note specified by its name instead of number. There is no performance issue between two versions. In general playing a note by it's name is much more readable then it's number. However this command is useful when you want to write the script to play the note whose number is stored in a variable.

Examples:

1. Play notes

NOTE:46
NOTE:48,2,3
NOTE:50

2. Play the note specified by variable

SET:NoteNum,50
NOTE:NoteNum

3. Play notes in a loop

SET:NoteNum,50
LABEL:NextNote
NOTE:NoteNum,7
MATH:NoteNum,--
IF:NoteNum,>,88,ExitLoop,NextNote
LABEL:ExitLoop
EXIT

See Also: NON, NOFF, a, a#, b, c, c#,...


NOTE_INTERVAL Statement

Sets the amount of time for which the note will be played if no such time is specified.

Syntax

NOTE_INTERVAL:<interval value>

The NOTE_INTERVAL statement syntax has these arguments

Part | Description
interval value | One interval is by default equals to 60ms

Short Form

NI

Remarks

Default value is 1. The value specified by NOTE_INTERVAL command is used only if no such value is supplied as the part of instruction to play the note.

Examples

1. NOTE_INTERVAL demonstration

c# 'Play note for default interval=1
NOTE_INTERVAL:8
c# 'Play note for new default interval=8
c#:3 'Play note for interval=3

See Also

SILENCE_INTERVAL, NOTE, a, a#, b, c, c#,...


Note By Name - MScript Commands - Visual Music

NOTE_ON

Command Format:

NOTE_ON:<Note name or number>,[octave],[volume]

What it does:

Starts playing the specified note but doesn't stops playing that note until you call NOFF or STOP. This command is similar to a, a#, c c# etc commands to play note except that the interval for how long note will be played is not specified. You can use this command to simultaneously play many notes within a single tune but it's time taking to calculate and stop the notes. See the examples.

Short Form:

NON

Parameters:

Note name or number: Note name (i.e. a,a#,c,c# etc) or direct number of note you want to start.
Octave: In which octave to play the note. Also supports ++ etc operators. If note specified currently set octave is used.
Volume: Volume with which the note should be played. Also supports ++ etc operators. If note specified currently set volume is used.

Value constraints:

Note Number: 0-87 or a,a#,b,c,c#,d,d#,e,e#,f,g,g#
Octave: 0 - 7
Volume: 0-100

Remarks:

This command is equivalent to commands like a, a#, b. c# etc which plays the note specified by its name instead of number. There is no performance issue between two versions. In general playing a note by it's name is much more readable then it's number. However this command is useful when you want to write the script to play the note whose number is stored in a variable. Octave argument is optional but is desirable to improve readability. If change the octave before stopping note you must supply octave while turning the note off.

Examples:

1. Play note for interval = 10

INSTRUMENT:Flute
NOTE_ON:a#
WAIT_FOR:10
NOTE_OFF:a#

2. Play the notes a# in octave 3 and c# in octave 4 simultaneously. Insert some delays so that both could be distinguished.

INSTRUMENT:Flute
NOTE_ON:a#,3 'Start a#
WAIT_FOR:3
NOTE_ON:c#,4 'Start c#
WAIT_FOR:50
NOTE_OFF:a#,3 'Stop a#
WAIT_FOR:10
NOTE_OFF:c#,4 'Stop c#

See Also:

NOTE, NOFF, a, a#, b, c, c#,...


Note By Name - MScript Commands - Visual Music

Note By Name

Command Name: <Note_Name>:[Note Interval],[Silence interval],[octave], volume]
where Note_Name is any of this: a, a#, b, c, c#, d ,d#, e,e#, f, g#

What it does: Plays the specified note.

Short Form: None.

Parameters:
Note Interval: How long the note should be plaid. If note specified standard note interval is used (default is ).
Silence Interval: How long to keep silence after playing the note. If note specified standard silence interval is used (default is 4).
Octave: In which octave to play the note. Also supports ++ etc operators. If note specified currently set octave is used.
Volume: Volume with which the note should be played. Also supports ++ etc operators. If note specified currently set volume is used.

Value constraints:
Note Interval: If 0, Note is played for shortest interval limited only by CPU speed
Silence Interval: If 0, no silence is inserted, i.e., if second note is there it will be played immediately.
Octave: 0 - 7.
Volume: 0-100. No error check in range.

Remarks:

Examples:
1. Play notes by name

'Play notes
a b c c# d a

2. Specify the interval

'Play the note a# for the interval =5 (each interval is of 60ms)
a#:5

2. Specify interval for silence

'Play the note c for the interval =5 followed by silence for interval of 2 followed by note c# with default interval
c:5,2 c#

3. Specify octave

'Play the note c# in the octave=default octave + 3 with volume=50 interval = 5 followed by silence for interval of 2
c#:5,2,++3,50

See Also: NOTE, NON, NOFF


OCTAVE Statement

Sets the octave in which next notes will be played. See What is Note, Octave and bla bla bla

Syntax

OCTAVE:<Octave number>

The OCTAVE statement syntax has these arguments

Part | Description
Octave number | Octave number

Short Form

O

Remarks

This value is used only if you do not specify the octave as the part of the instruction. Default value is 4. You can specify values as high as 256 but it produces some unpredictable effects.

Examples

1. Set octave to 2 and then 6

OCTAVE:2
a b c
OCTAVE:6
a b c

2. Play notes in decreasing octave

SET:Count,7
LABEL:TheLoop
OCTAVE:Count
c# a a
MATH:Count,--
IF:Count,>,0,TheLoop

See Also

PAN, VOLUME, SET, a, a#, b, c, c#,...


SaveSetting Statement

PAN Statement

Sets the difference of amount of loudness with which higher notes and lower notes are played. See What is Note, Octave and bla bla bla

Syntax

PAN:<Pan value>

The PAN statement syntax has these arguments

Part | Description
Pan value | Pan value

Short Form

None

Remarks

Default value is 64 which means all notes are played at equal volume.

Examples

1. Play notes in seperate pans

PAN:22
O:2 a#
O:6 a#
PAN:100
O:2 a#
O:6 a#

2. Play notes in decreasing pan

SET:Count,87
PAN:20
LABEL:TheLoop
NOTE:Count
MATH:Count,--
IF:Count,>,0,TheLoop

See Also

OCTAVE, VOLUME, SET, a, a#, b, c, c#,...


PAUSE Statement

Pauses another running tune or itself.

Syntax

PAUSE:[Tune Name]

The PAUSE statement syntax has this arguments

Part | Description
Tune Name | Name of the tune that needs to be paused. If no Tune Name specified then currently running tune is paused.

Short Form

None

Remarks

This instruction allows you pause other running tunes or itself. You can continue running other tunes by issuing PLAY instruction. But if a tune pauses itself it can not restart itself!

Examples

1. Write in Tune1 following:

NOTE_INTERVAL:5
a b a a# b
PLAY:Tune2
a a# c
PAUSE:Tune2 'Tune2 execution paused
c# d a a a#
PLAY:Tune2 'Tune2 execution resumed
c d d#

2. Write in Tune2 following:

NOTE_INTERVAL:5
INSTRUMENT:Sitar
a b a a# b a a# c c# d a a a# c d d#

Play the Tune1 only.

See Also

PLAY, STOP, EXIT


PLAY Statement

Starts playing another tune simultaneously.

Syntax

PLAY:<Tune Name>,[Jump Label in Tune]

The PLAY statement syntax has these arguments

Part | Description
Tune Name | Tune that needs to be started simultaneously.
Jump Label in Tune | From where inside the specified tune execution should start. If no labels specified then execution starts at 1st instruction.

Short Form

P

Remarks

This is very significant instruction which allows you to run another tune simultaneously from any other tune. For example, in one tune you can play one instrument and in another you can simultaneously play another instrument.

Examples

1. Write in Tune1 following:

NOTE_INTERVAL:5
a b a a# b
PLAY:Tune2
a a# c c# d a a a# c d d#

2. Write in Tune2 following:

INSTRUMENT:Music_Box
a b a a# b a a# c c# d a a a# c d d#

See Also

STOP, PAUSE, EXIT


PRINT Statement

Prints the value of specified variable or parameter in the debug window.

Syntax

PRINT:<Variable or parameter name>,[Tag Word]

The PRINT statement syntax has these arguments

Part | Description
Variable or parameter name | This could be the name of the variable whoops value is needed to print or any of the following strings: NI - to print the value of current Note Interval SI - to print the value of current silence Interval OCTAVE - to print the value of current octave VOLUME - to print the value of current volume settings PAN - to print the value of current pan settings NOTE: The parameter name above must be in upper case.
Tag Word | This is simply any string without space that you want to print along with the value

Short Form

None

Remarks

This instruction is vary useful for debugging purposes when you want to know what is the value of a variable or some MIDI parameter at any point in the script. The PRINT statement prints a line with following format:

Name_of_tune : Tag_Word, value

Examples

1.
SET:MyVar
RANDOM:MyVar,1000
PRINT:MyVar,Some_Random_Value

2.
SET:MyVar
RANDOM:MyVar
PRINT:MyVar

See Also

SET, OCTAVE, VOLUME, PAN, NOTE_INTERVAL, SILENCE_INTERVAL


RANDOM Statement

Sets the specified variable with the randomly generated integer.

Syntax

RANDOM:<Variable name>,[Upper Limit]

The RANDOM statement syntax has these arguments

Part | Description
Variable Name | Name of the variable in which random number will be stored.
Upper Limit | Upper limit of the generated number (including this number). Default is 100.

Short Form

None

Remarks

This instruction is useful you want to play random tunes or set random octave etc.

Examples

1.
SET:NoteNum
LABEL:TheLoop
RANDOM:NoteNum,88
NOTE:NoteNum,3,0
IF:Count,<,88,TheLoop

See Also

SET, IF, JUMP


RELEASE Statement

What it does: Releases the MIDI channel for the use of other tunes.

Syntax

RELEASE

The RELEASE statement syntax has no arguments

Short Form

None

Remarks

The MIDI device has only 16 channels in which you can play music. If you try to run more then 16 tunes simultaneously you will get "Out of channels" error (you can create more then 16 tunes but only 16 of them should be actively running at any time). The RELEASE instruction allows you to release the MIDI channel if you are not using it and hence there by use can run more tunes simultaneously. MIDI Engine incorporates smart channel pooling and automatic channel release during long silence periods so you should be almost never bother about using this instruction. Also note that there is no instruction for acquiring channels. Channel allocation is done completely automatically depending on which channel is free.

Examples

1.Write in Tune1 following:

'Say you are not playing any note here
'but only doing some arithmetic etc
'so release the channel so that others may use it.
RELEASE
---long processing---
a a# 'When you play notes next time, channel is automatically allocated

See Also

STOP, EXIT


SET Statement

Set the value of the variable to the specified value.

Syntax

SET:<Variable Name>,[Variable Value]

The SET statement syntax has these arguments

Part | Description
Variable Name | Name of the variable needed to be created or whose value is needed to be set.
Variable Value | Value with which variable is to be set.

Short Form

None

Remarks

A variable is an entity which may contain some value that you can read anytime or if you want you can set it's value to something else. SET statement creates a variable if it didn't existed. You must use SET first if you want to use variable.

Examples

1.

SET:NoteVal,52
NOTE:NoteVal

SET:NoteVal,++ 'Increment by one
NOTE:NoteVal 'Play this note

2.

SET:Count,28
LABEL:TheLoop
INSTRUMENT:Count
c# a a b a#
MATH:Count,++
IF:Count,<,128,TheLoop

See Also

IF, JUMP


SILENCE Statement

Does nothing until specified interval is passed. It's essentially produces silence between two notes.

Syntax

SILENCE:<interval value>

The SILENCE statement syntax has these arguments

Part | Description
interval value | One interval is by default equals to 60ms.

Short Form

S

Remarks

Default value is 1. You can also specify silence interval as the part of the note command.

Examples

a#
SILENCE:10
a#

2. 'Exactly same thing

a#
WAIT_FOR:10
a#

3. 'Exactly same thing

c#:,10
a#

See Also

NOTE_INTERVAL, SILENCE_INTERVAL, WAIT_FOR, NOTE, a, a#, b, c, c#,...


SILENCE_INTERVAL Statement

What it does: Sets the note interval value that will be used if no note interval is specified explicitly in the note commands.

Syntax

SILENCE_INTERVAL:<interval value>

The SILENCE_INTERVAL statement syntax has these arguments

Part | Description
interval value | One interval is by default equals to 60ms

Short Form

SI

Remarks

Default value is 1. Silence could be also inserted by SILENCE command. The value specified by SILENCE_INTERVAL command is used only if no such value is supplied as the part of instruction to play the note.

Examples

1. Silence interval demo

c#  a# 'Play the note followed by silence for default interval=4

SILENCE_INTERVAL:8
c#  a# 'Play the note followed by silence for new default interval=8

c#:,3 a# 'Play the note followed by silence for interval=3

See Also

SILENCE_INTERVAL, NOTE, a, a#, b, c, c#,...


SaveSetting Statement

STOP Statement

Stops playing another tune or itself.

Syntax

STOP:[Tune Name]

The STOP statement syntax has these arguments

Part | Description
Tune Name | Tune that needs to be stopped. If no Tune Name specified then currently running tune is stoped (which is same as EXIT). Tune name must exist is specified.

Short Form

None

Remarks

This instruction allows you stop other running tunes or itself.

Examples

1. Write in Tune1 following:

NOTE_INTERVAL:5
a b a a# b
PLAY:Tune2
a a# c
STOP:Tune2 'Tune2 execution terminated
c# d a a a#
STOP 'Execution is stoped here
c d d#

2. Write in Tune2 following:

NOTE_INTERVAL:5
INSTRUMENT:Sitar
a b a a# b a a# c c# d a a a# c d d#

See Also

PLAY, PAUSE, EXIT


TEMPO Statement

Slows down the execution by the factor of the specified value. It's kind of slow motion playing.

Syntax

TEMPO:<Slow down factor>

The TEMPO statement syntax has these arguments

Part | Description
Slow down factor | The factor with which system clock would be slowed down.

Short Form

None

Remarks

Default value is 1. This command slows down the whole script. Useful to inspect what's happening when notes are played very fast.

Examples

a a# b c# 'Normal speed

TEMPO:3

a a# b c# 'Now in 3 times lower speed

See Also

NOTE_INTERVAL, SILENCE_INTERVAL, WAIT_FOR, NOTE, a, a#, b, c, c#,...


VOLUME Statement

What it does: Sets the amount of loudness with which next notes would be played

Syntax

VOLUME:<Volume number>

The VOLUME statement syntax has these arguments

Part | Description
Volume number | Volume number: 0-100. Higher values could be specified but not recommended.

Short Form

V

Remarks

Default value is 100 (i.e. full). You can specify values as high as 255 but it produces some unpredictable effects.

Examples

1. Play with full volume

VOLUME:100
a b c

2. Play with half volume

VOLUME:50
a b c

3. Play with decreasing volume

SET:Count,100
LABEL:TheLoop
VOLUME:Count
c# a a
MATH:Count,--
IF:Count,>,0,TheLoop

See Also

OCTAVE, VOLUME, SET, a, a#, b, c, c#,...


WAIT_FOR Statement

What it does: Waits for specified amount of time before next instruction is executed.

Syntax

WAIT_FOR:<interval value>

The WAIT_FOR statement syntax has these arguments

Part | Description
interval value | One interval is by default equals to 60ms

Short Form

WF

Remarks

Default value is 1. This command is exactly same as SILENCE command.

Examples

c#
WAIT_FOR:10
a#

'Exactly same thing

c#
SILENCE:10
a#

'Exactly same thing

c#:,10
a#

See Also

NOTE_INTERVAL, SILENCE_INTERVAL, SILENCE,
NOTE, a, a#, b, c, c#,...


Timing In MScript - Visual Music

Timing In MScript

For musical instruction:

The time interval specifies how long a note will be played. MScript commands allows you to play any notes for the time interval as specified by you. However for simplicity, time interval is not specified in the units of mill seconds or seconds but in terms of a special unit called MScript Time Interval. Each MScript time interval is 60ms long. So if you say "Play the note c# for interval = 5" it means "Play the note c# for 300ms". The default time interval for a note is 1 (i.e.60ms). So, the command c# will play the note "c#" for 60ms by default. But the command c#:6 will play the note note "c#" for 6*60=360ms. You can change this default time interval by NOTE_INTERVAL command. For example,

C#                            'Play the note C# for interval=1 (default)
NOTE_INTERVAL:7               'Change the standard note interval
C#                            'Play the note C# for interval=7 (new default)
C#:10                         'Play the note C# for interval=10 (override the default)

For Non-Musical Instruction:

The none musical instructions (i.e. instructions that does not play any musical notes or silence) like JUMP, MATH, IF etc essentially do not take any time to execute. This means that non-musical instruction doesn't
introduces any significant delay. For example, To execute following 4 instructions 4 clock cycles would be required because each note is played for 1 clock (default interval):

a b c d

To execute following 1 instruction, again 4 clock cycles would be required because note is specified to run for 4 cycles:

a:4

However to execute following 4 instructions it will still require only 4 cycles because non-musical instructions are executed one after another irrespective of clock cycle:

a:4
IF:Var1,<>,5,SomeWhere 'Non musical instruction
SET:Var1,5  'Non musical instruction
MATH:Var1,++  'Non musical instruction


MScript Samples

MScript samples are stored in Samples folder inside the Babya Visual Music's folder. You can use Babya Visual Music's File Open menu to open each sample and experiment with it.


MScript File Format - Visual Music

MScript File Format

The scripts written for all tunes are stored in single .MSC file (MSC for MScript). It's text file and you can edit it with any text editor. Following is the sample .MSC file when opened in Notepad.

Following is the general lay out of file. The fields inside <> are compulsory.

MScript:[Param1],[Param2] VER:<CompatibleVer1>,[CompatibleVer2],...
TIMER:<Timer_Val>

START_TUNE:<TuneName1>,[Param1],[Param2]

--MScript commands

END_TUNE:<TuneName1>

START_TUNE:<TuneName2>,[Param1],[Param2]

--MScript commands

END_TUNE:<TuneName2>

------------
--More tunes
------------

The first filed, i.e. MScript:[Param1],[Param2] is the signature. Currently no parameters are used so it's just MScript. This signature helps to identify whether user is trying to open valid MScript file or something else that might have been renamed to .MSC or whether file was corrupted.

The 2nd field, i.e. VER:... indicates to which versions the MScript in the file is compatible to. For example, if there is new version of MScript in future (say 2.0) which is also partially backward compatible to 1.0 and that scripts in file .MSC does not uses any 2.0 only features then VER field
could be, VER:2.0,1.0

Now say their is entirely different flavour of MScript with it's own version numbers, then it can mark MSC file with: VER:NewKind1.0

When you open such MSC file in Babya Visual Music it will show you message that script in the MSC file is not compatible with what it understands. However now say NewKind type of MScript is also compatible with MScript used by Babya Visual Music, it can mark version as...
VER:NewKind1.0,VMusic1.0

Or as..

VER:NewKind1.0,1.0

In short, if Babya Visual Music finds 1.0 or VMusic1.0 in the compatible version list, it will open it happily or otherwise it will give out an error.

Next, the TIMER:<Timer_Val> is used to specify the interval used. For example when you say a#:2 it means play the note a# for 2 intervals. Each interval is by default 60ms. So the TIMER field looks like this, TIMER:60

If in future true multithreading is employed then it would be possible to decrease this timer value and play a note for even more short period. Next, script for each tune is enclosed between two markers START_TUNE and END_TUNE. START_TUNE can also take parameters but none is used currently.


Developer Reference - Visual Music

Developer Reference

This section is specifically meant for developers who wish to extend Babya Visual Music. The Babya Visual Music supports several ways to extend it self. This section will give you overview of these ways. This section also contains information on MIDI programming.


Extending Visual Music - Visual Music

Extending Babya Visual Music

Babya Visual Music provides you several way to extend itself.

  • You can write Add-Ins for Babya Visual Music. Add-ins are also called plug-ins which integrates itself with target software and adds more functionality to it.
  • You can script the Babya Visual Music Object model using VBA or VBScript.
  • You can write your DDE client to control Babya Visual Music. DDE is the way to talk to the running application. Babya Visual Music is also a DDE server.
  • You can run Babya Visual Music with command line parameters.
  • Finally Babya Visual Music source code is available upon request. You too can take part in the Babya Visual Music development.


Visual Music Object Model - Visual Music

Babya Visual Music Object Model

Babya Visual Music takes full advantage of component-based architecture. Babya Visual Music screen is just an user interface for several behind-the-curtain ActiveX objects. Almost all the functionality is packed in these ActiveX objects. You too take make your own user interfaces for these ActiveX objects. You can also script these objects using various scripting languages available. However note that in this beta version these objects are not currently exposed in separate DLL but is compiled in to same EXE. This is, for the time being, for preventing version conflicts in the final version. However this objects are written in a way that they can be taken out of EXE and compiled in to separate DLLs at any time.

Following is the short descriptions of the various objects available:

  • ClockProvider: This is simply the wrapper for the clocking device needed for InstructionProcessor. When I started writing Babya Visual Music, I first used VB's Timer control itself. But later I upgraded it to Marbey's precision timer control. In future there could be something else. So it was evident that code can't be changed every time when timing control changes. The ClockProvider class shields against such changes.
  • InstructionProcessor: This is the hart of Babya Visual Music. It's basically the "CPU" or "Virtual Machine" for the MScript instructions. It takes compiled binary instructions and executes them.
  • Instructions: The Instructions object holds compiled instructions. You specify which Instructions object you want to use with InstructionProcessor. The Instructions object is created by MScriptCompiler.
  • InstrumentManager: This object manages list of available instruments. It loads instrument names and numbers from INI file. It also creates INI file of the favourite instruments.
  • MIDIEngine: This is the lowest level class that actually plays, stops and does all other things like changing instrument, octaves, volume etc by calling MIDI API. It also implements MIDI channel pooling.
  • MScript: This object manages the script written for one tune and it's compiled version. It automatically compiles the script when it is changed and a request to play it is made.
  • MScriptCompiler: This object compiled the script and gives Instructions object containing binary version of script.
  • MScriptRecorder: This object captures several events that are generated when a note is played or stopped. Using this events it creates the MScript commands that will reproduce the played note. MScript recorder currently does not support multi key press.
  • MScripts: This object manages the set of MScript objects. It also provides methods to create the text that could be saved in a file and later on load it from the file.


Visual Music Object Model - Visual Music

Babya Visual Music ActiveX Controls

Babya Visual Music also contains many ActiveX controls to simplify your task of creating your own UI. As with Babya Visual Music objects, these ActiveX controls are currently compiled in to same EXE instead of exposing through OCX files to prevent version conflicts in final version.

Following is the short descriptions of each of the ActiveX control available:

  • InstrumentSelector : This control allows the user to select an instrument from the available list. It also provides the way to mark an instrument as your favourite, do a search and play the sample while selecting it.
  • MIDIKeyboard: This is the set of white and black keys that gives Piano like looks. This control generates event when you press one of the piano key. It also manages key stroke translation.
  • MIDIParamControls : This is a simple control with facility to select an octave, volume and pan.
  • MScriptEditor: This controls allows you to type the script for the tune, create new tunes, manage them, automatically save script for the tune on lost focus and much more!


Visual Music DDE Commands - Visual Music

Babya Visual Music DDE Commands

Babya Visual Music is also a DDE server allowing other programs to talk with it using DDE link. For example, your application can detect the existing Babya Visual Music instance by trying to set up a DDE link. Or even ask Babya Visual Music to load a specific file and play it. The Babya Visual Music itself uses it's own DDE capability to load the file in the existing instance when you click it in the Explorer. Below is the short description few DDE commands.

DDE Server Specifications:

LinkTopic: Babya Visual Music|Main
LinkItem: BaseCommands

DDE Server Command List:

  • ACTIVATE Brings the currently running Babya Visual Music instance in front of all windows.
  • EXIT Ends the currently running Babya Visual Music instance.
  • PLAY([TuneName]) Plays the specified tune. If tune is not specified the it plays currently selected tune.
  • PLAY_ALLPlays all the tuns simultaneously.
  • STOP_PLAYStops any tunes that is currently being played.
  • LOAD(FileName) Loads the specified file.
  • SAVESaves the current tunes.
  • SAVE_AS(FileName) Saves the current tunes in to specified file.
  • NEWStarts new composition.
  • SHOW_HELP(HelpTopic) Shows specified help topic.


Visual Music Command Line Parameters - Visual Music

Babya Visual Music Command Line Parameters

Babya Visual Music is planned to have several command line options which will provide the simplest method to invoke and control Babya Visual Music. However in this edition, Babya Visual Music supports only two parameters:

  • /RegIcon When passed this parameter to Babya Visual Music, the MSC file extenstion is associated with Babya Visual Music and it's icon is also registered with the MSC file extension. Babya Visual Music exits after doing this registrations.
  • [FileName] When passed a file name as a parameter, Babya Visual Music load it on start up.


MIDI Programming Guide

Space and time doesn't permit me to write full featured guide on MIDI programming. But it's fairly simple. Almost all things such as playing/stopping notes, setting instruments etc could be achieved by API function midiOutShortMsg in winmm.dll library. Unfortunately the parameter values that you can pass to this function is completely undocumented and even I still don't know it's ins and outs. However you can get several sample code from Internet and get the idea of it. I'll try to update this section in future. By the time if you need help do contact me at shital_s@usa.net.

Here's the simplified code for how to call midiOutShortMsg function,

'API declaration

Private Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long

Private Sub SendMidiOut(ByVal vlEvent As Long, ByVal vlNote As Long, ByVal vlVelocity As Long)

    'vlEvent - is command to MIDI device
    'vlVelocity - is another name for Volume

    Dim lLowWord As Long
    Dim lHighWord As Long
    Dim lMidiAPIReturn As Long
    Dim lMidiMessage As Long

    lLowWord = (vlNote * 256) + vlEvent
    lHighWord = ((vlVelocity Mod 256) * 256) * 256

    lMidiMessage = lLowWord + lHighWord

    lMidiAPIReturn = midiOutShortMsg(mlMIDIOutHandle, lMidiMessage)
    'Check the return value

End Sub

Following is what the 32 bits lMidiMessage means in second parameter of midiOutShortMsg:

______________________________
|_7_|_6_|_5_|_4_|_3_|_2_|_1_|_0_|

0 - Channel number for which this MIDI command is meant for
1 - MIDI command (hex value):
8: Turn note OFF
9: Turn note ON
A: Polyphonic key after touch
B: Control change
C: Instrument change
D: Channel after touch
E: Pitch bend change
F: System
2,3.4,5 - data for the MIDI command
6,7 - Note used

Here's example of how above function used:

Here's how to start a note:

 lMidiEvent = 144 + m_lChannel
Call SendMidiOut(lMidiEvent, lActualMidiNote, lMidiVolume)

Here's how to stop a note

lMidiEvent = 144 + m_lChannel
Call SendMidiOut(lMidiEvent, lActualMidiNote, 0)

Here's how to change the instrument

lMidiEvent = &HC0 + m_lChannel
lMidiNote = m_lInstrument
lMidiVolume = 0
Call SendMidiOut(lMidiEvent, lMidiNote, lMidiVolume)

Also to refer following topic in MSDN library (available also at http://msdn.microsoft.com:
Platform SDK/Graphics and Multimedia Services/Windows Multimedia/Musical Instrument Digital Interface(MIDI) Here you will find just too much information here. You can read important topics such as MIDI out API functions.

Here's few sites that can be helpful:

Kyle's Music Theory Page
MusicSearch The Internet's Music-Only Search Site
GS - XG - GM MIDI Software


Open Source Developement- Visual Music

Open Source Developement

If you are creative enough and knows how to program in Visual Basic, come on and join in!! If your jobs are not that much exciting and tired of doing same old mechanical things, here's your chance. Grabe it or miss it! If your free time really kills you because you don't know what to do. There's probably isn't much better. And if you can't really stay without your programming addiction, I have drugs to spend nights on!

Write me at shital_s@usa.net


About Visual Music

About

Babya Visual Music is the program to create music using your sound card's MIDI device. It also provides the language to write script for creating music called MScript.


Open Source Development Visual Music

Open Source Development

If you are creative enough and knows how to program in Visual Basic, come on and join in!! If your jobs are not that much exciting and tired of doing same old mechanical things, here's your chance. Grab it or miss it! If your free time really kills you because you don't know what to do, there's probably isn't much better then joining open source development. And if you can't really stay without your programming addiction, I have drugs to spend nights on! Write to me at shital_s@usa.net